set WSL’s default distribution
Got it 👍 — you want to set WSL’s default distribution so that when you type wsl it automatically logs you into Ubuntu. Here’s how to do it:
Open PowerShell or Command Prompt and run:
wsl --list --verbose
This shows all installed distributions and their states. You’ll see names like Ubuntu, Ubuntu-20.04, Ubuntu-22.04.
Run:
wsl --set-default Ubuntu
or, if you installed a specific version:
wsl --set-default Ubuntu-22.04
Check again with:
wsl --list --verbose
The default distro will be marked with an asterisk *.
Now, simply typing:
wsl
will drop you directly into Ubuntu.
⚡ Extra tip: If you want to always log in as root or a specific user inside Ubuntu, you can configure it:
wsl -d Ubuntu -u root
Or set the default user inside Ubuntu with:
sudo nano /etc/wsl.conf
Add:
[user]
default=yourusername
Then restart WSL:
wsl --shutdown
| File5 | File | Last Modified |
|---|---|---|
| 在WSL 中安裝 Ubuntu | 在WSL 中安裝 Ubuntu | 2:25 PM - January 12, 2026 |
| Windows 上透過 WSL 進入 Ubuntu shell | Windows 上透過 WSL 進入 Ubuntu shell | 2:25 PM - January 12, 2026 |
| Restart Docker | Restart Docker | 2:25 PM - January 12, 2026 |
| Force restart WSL | Force restart WSL | 2:25 PM - January 12, 2026 |
| install Ubuntu on WSL | install Ubuntu on WSL | 2:34 PM - December 15, 2025 |